import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token-'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}


// 传入key 获取存在sessionStorage
export function getItem(key, type = 0) {
  if (type === 0) {
    return sessionStorage.getItem(key)
  }else{
    const a = sessionStorage.getItem(key)
    return JSON.parse(a)
  }

}

export function setItem(key, value) {
  sessionStorage.setItem(key, value)
}
